package com.aisile.manager.controller;


import com.aisile.entity.PageResult;
import com.aisile.entity.Result;
import com.aisile.pojo.TbTypeTemplate;
import com.aisile.sellergoods.service.TypeTemplateService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("typeTemplate")
public class TypeTemplateController {

    @Reference
    TypeTemplateService typeTemplateService;

    @RequestMapping("findPage")
    public PageResult findPage(int page, int rows, @RequestBody TbTypeTemplate tbTypeTemplate){

        return typeTemplateService.findPage(page,rows,tbTypeTemplate);
    }

    @RequestMapping("save")
    public Result save(@RequestBody TbTypeTemplate tbTypeTemplate){

        try{
            typeTemplateService.save(tbTypeTemplate);
            return new Result(true,"成功");
        }catch (Exception e){

            return new Result(false,"服务器出现异常");
        }

    }
    @RequestMapping("findOne")
        public TbTypeTemplate findOne(long id){

        return typeTemplateService.findOne(id);

    }

    @RequestMapping("update")
    public Result update(@RequestBody TbTypeTemplate tbTypeTemplate){

        try{
            typeTemplateService.update(tbTypeTemplate);
            return new Result(true,"成功");
        }catch (Exception e){

            return new Result(false,"服务器出现异常");
        }

    }




}
